package com.shiwaixiangcun.customer.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shiwaixiangcun.customer.R;
import com.shiwaixiangcun.customer.entity.MineEntity;

import java.util.List;

/**
 * @author Administrator
 * @date 2017/12/9
 */

public class AdapterMine extends BaseQuickAdapter<MineEntity, BaseViewHolder> {


    /**
     * 是否是物业电话
     */
    private final static String IS_NUMBER = "NUMBER";

    public AdapterMine(@Nullable List<MineEntity> data) {

        super(R.layout.item_layout_mine, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MineEntity item) {

        helper.setText(R.id.tv_name, item.strName);
        TextView rightView = helper.getView(R.id.tv_right_info);
        ImageView ivIcon = helper.getView(R.id.iv_icon);
        Glide.with(mContext).load(item.strCover).into(ivIcon);
        //判断当前项是否是物业电话
        if (IS_NUMBER.equals(item.flag)) {
            rightView.setVisibility(View.VISIBLE);
        } else {
            rightView.setVisibility(View.GONE);
        }

    }
}
